//
//  YXMineServiceViewController.m
//  CreditCard
//
//  Created by 杨旭 on 2017/12/25.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "YXMineServiceViewController.h"

@interface YXMineServiceViewController ()
@property (nonatomic ,strong) UIImageView *backImage;
@end

@implementation YXMineServiceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"联系客服";
    [self caretUI];
}

- (void)caretUI {
    UIImageView *backImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"图片_1"]];
    backImage.frame = self.view.bounds;
    [self.view addSubview:backImage];
    self.backImage = backImage;
    backImage.userInteractionEnabled = YES;
    
    UIImageView *phoneImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"客服-2"]];
    phoneImage.frame = CGRectMake(20,kScreenHeight - 130 ,270, 54);
    [backImage addSubview:phoneImage];
    
    UILabel *phoneLab = [UILabel setLabelWithText:@"客服001：025-83666667" fontSize:18 color:[UIColor blackColor]];
    phoneLab.frame = phoneImage.frame;
    phoneLab.textAlignment = NSTextAlignmentCenter;
    [backImage addSubview:phoneLab];
    
    UIButton *callBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    callBtn.frame = CGRectMake(phoneImage.W + phoneImage.X + 5, kScreenHeight - 130, 70, 54);
    [callBtn setBackgroundImage:[UIImage imageNamed:@"客服-1"] forState:(UIControlStateNormal)];
    [callBtn setTitle:@"呼叫" forState:(UIControlStateNormal)];
    [callBtn setTitleColor:color_blueColor forState:(UIControlStateNormal)];
    [callBtn addTarget:self action:@selector(callBtnAction:) forControlEvents:(UIControlEventTouchUpInside)];
    [backImage addSubview:callBtn];

}

- (void)callBtnAction:(UIButton *)sender {
    
    NSString * str=[[NSString alloc] initWithFormat:@"tel:%@",@"02583666667"];
    UIWebView * callWebview = [[UIWebView alloc] init];
    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
    [self.view addSubview:callWebview];
    
}

@end
